<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<% 
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
	pageContext.setAttribute("basePath",basePath);
%>
<%
	String phone = (String)request.getSession().getAttribute("phone");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
		<title>系统设置</title>
		<link rel="icon" href="<%=basePath %>views/gj/img/favicon.png" type="image/x-icon">
		<link rel="stylesheet" href="<%=basePath %>views/lcx/layui-v2.5.5/layui/css/layui.css" />
		<link rel="stylesheet" href="<%=basePath %>views/lcx/layui-v2.5.5/layui/css/modules/layer/default/layer.css" />
		<link rel="stylesheet" href="<%=basePath %>views/lcx/css/sysdesigner.css" />
		<script src="<%=basePath %>views/lcx/layui-v2.5.5/layui/layui.js"></script>
		<script src="<%=basePath %>views/lcx/layui-v2.5.5/layui/lay/modules/layer.js"></script>
		<script type="text/javascript" src="<%=basePath %>views/lcx/js/jquery-3.3.1.min.js" ></script>
		<script type="text/javascript" src="<%=basePath %>views/lcx/js/personalCenter.js" ></script>
	</head>
	<body onload="startTime()">
		<input type="hidden" id="indexMsg" value="${msg }"/>
		<div style="width: 1000px; margin: 0 auto;">
			<div class="hhhh">
				<div class="header">
					<div style="display: inline-block;">
						<img width="587px" src="${basePath }views/lcx/img/logo.png" class="logo"/>
					</div>
					<div style="display: inline-block; vertical-align: top; height: 130px; margin-top: 30px;">
						<font>
							<span id="nowDateTimeSpan"></span>
						</font> 
						<div style="width: 240px;">
							<iframe frameborder="0" allowtransparency="true" src="http://i.tianqi.com/index.php?c=code&id=36&icon=5&num=1"></iframe>
						</div>
					</div>
					<div style="display: inline-block; ">
						<c:choose>
							<c:when test="${user==null }">
								<div style="display: inline-block; margin: 0px 20px; position: relative;" id="flag1">
									<a style="margin: 0px 5px;" href="${basePath}views/user/login.jsp" class="login">登录</a>
									<a style="margin: 0px 5px;" href="${basePath}views/user/register1.jsp" class="register">注册</a>
								</div>
							</c:when>
							<c:otherwise>
								<div style="display: inline-block; padding-left: 20px; padding-top: 20px;" id="flag2">
									<a title="个人中心" href="<%=basePath %>personInit" style="margin: 0; padding: 0;">
										<c:choose>
											<c:when test="${user.head_photo==null }">
												<img width="100px" height="100px" src="<%=basePath %>views/lcx/img/2016061417302085.jpg"/>
											</c:when>
											<c:otherwise>
												<img width="100px" height="100px" src="${user.head_photo }"/>
											</c:otherwise>
										</c:choose>
									</a>
								</div> 
							</c:otherwise>
						</c:choose>
					</div>
				</div>
				<div class="Navigation">
					<ul>
						<li><a href="<%=basePath %>index.do">首页</a></li>
						<li><a href="<%=basePath %>views/user/list.jsp">非遗清单</a></li>
						<li><a href="<%=basePath %>views/zcs/answerpage/main.jsp">非遗知多少</a></li>
						<li><a href="<%=basePath %>views/zcs/answerpage/moyi_succeed_.jsp">传承现状</a></li>
						<li><a href="<%=basePath %>views/jzl/compony.jsp"><span>莫遗小窝</span></a></li>
						<li><a href="<%=basePath %>luntan">论坛</a></li>
						<li><a href="<%=basePath %>views/user/maptest.jsp">非遗一览</a></li>
						<li><a href="<%=basePath %>views/user/activity.jsp">活动公告</a></li>
						<c:if test="${user.status==1 }">
							<li><a href="${basePath}sysInit">系统设置</a></li>
						</c:if>
					</ul>
				</div>
			</div>
			<div class="main">
				<div class="content-left">
					<ul class="layui-nav layui-nav-tree" lay-filter="test">
					  <li id="liq1" class="layui-nav-item">
					    <a href="${basePath}sysInit">图片轮播</a></li>
					  <li id="liq2" class="layui-nav-item layui-nav-itemed">
					    <a href="${basePath }views/lcx/hot-special.jsp">热门专题</a></li>
					  <li id="liq3" class="layui-nav-item">
					  	<a href="${basePath }views/lcx/noticeManager.jsp">公告发布</a></li>
					  <li id="liq4" class="layui-nav-item">
					  	<a href="${basePath }views/lcx/addList.jsp">新增清单</a></li>
					  <li id="liq4" class="layui-nav-item">
					  	<a href="${basePath }views/lcx/listManager.jsp">清单管理</a></li>
					</ul>
				</div>
				<div class="content-right hot-special">
					
					<div class="special-list">
						<span>专题列表：</span>
						<ul class="n_list">
							<li id="1"><a name="游艺竞技" onclick="selecttype(1)" class="current">游艺竞技</a></li>
							<li id="2"><a name="民间美术" onclick="selecttype(2)">民间美术</a></li>
							<li id="3"><a name="民间舞蹈" onclick="selecttype(3)">民间舞蹈</a></li>
							<li id="4"><a name="民间戏剧" onclick="selecttype(4)">民间戏剧</a></li>
							<li id="5"><a name="民间音乐" onclick="selecttype(5)">民间音乐</a></li>
							<li id="6"><a name="民间杂技" onclick="selecttype(6)">民间杂技</a></li>
							<li id="7"><a name="民间手工技艺" onclick="selecttype(7)">民间手工技艺</a></li>
							<li id="8"><a name="消费习俗" onclick="selecttype(8)">消费习俗</a></li>
							<li id="9"><a name="岁时节令" onclick="selecttype(9)">岁时节令</a></li>
							<li id="10"><a name="民间文学" onclick="selecttype(10)">民间文学</a></li>
							<li id="11"><a name="曲艺" onclick="selecttype(11)">曲艺</a></li>
							<li id="12"><a name="民间信仰" onclick="selecttype(12)">民间信仰</a></li>
							<li id="13"><a name="民间知识" onclick="selecttype(13)">民间知识</a></li>
						</ul>
					</div>
					<div class="spacial-set">
						<button type="button" onclick="add()" id="adds" name="0" class="layui-btn">移入>></button>
						<div></div>
						<button type="button" onclick="del()" id="dels" name="0" class="layui-btn layui-btn-normal"><< 移出</button>
					</div>
					<div class="hot-special-list">
						<span>当前设置的热门专题：</span>
						<ul class="n_list">
						</ul>
					</div>
				</div>
			</div>
			<div id="foot" class="foot">
				<hr class="layui-bg-orange">
				<div class="copyright">
					小莫2019
				</div>
				<div class="copyright">
					All Rights Reserved 版权所有，违者必究
				</div>
				<div class="copyright">
					河南省郑州市高新区科学大道100号
				</div>
				<div class="copyright">
					联系我们 邮箱：iezljin@163.com QQ：2313954270
				</div>
				<div class="footright">
					<div class="footblock">
						<img src="<%=basePath %>views/lcx/img/weichatQRCode.jpg" />
						<div>莫遗官方微信公众号</div>
					</div>
					<div class="footblock">
						<img src="<%=basePath %>views/lcx/img/weibo.png" />
						<div>莫遗官方微博</div>
					</div>
					<div class="footblock">
						<img src="<%=basePath %>views/lcx/img/QQtalk.jpg" />
						<div>莫遗官方QQ讨论群</div>
					</div>
				</div>
			</div>
		<script type="text/javascript">
			$(function(){
				$.ajax({ //
					type : "get",
					url : "${basePath}hotspecialsysInit", //添加操作的路径
					dataType : "JSON", //返回JSON格式的数据
					async : false,//同步传输
					success : function(data) {
						$.each(data,function(){
							$("#"+this.listtype).css("display","none");
							$(".hot-special-list .n_list").append("<li id='a"+this.listtype+"'><a name='"+this.title+"' onclick='dettype("+this.listtype+")'>"+this.title+"</a></li>");
						});
					}
				});
			});
			layui.use('element', function(){
			  var element = layui.element;
			  
			  //…
			});
			
			function selecttype(data){
				var a=$("#adds").attr("name");
				if(a!=0){
					$("#"+a).find("a").css("color","#333333");
				}
				$("#adds").attr("name",data);
				$("#adds").css("background-color","#00F7DE");
				$("#"+data).find("a").css("color","#666666");
			}
			
			function add(){
				var data = $("#adds").attr("name");
				if(data!=0){
					var name = $("#"+data).find("a").attr("name");
					$.ajax({ //
						type : "get",
						url : "${basePath}addhotspecial", //添加操作的路径
						data :{title:name,listtype:data},
						dataType : "JSON", //返回JSON格式的数据
						async : false,//同步传输
						success : function(data) {
							if(data==0){
								alert("添加失败！！");
							}else if(data==2){
								alert("请先登录！！");
							}else if(data==3){
								alert("热门专题最多设置三个！！");								
							}
							location.reload();
						}
					});
				}
				
			}
			
			function dettype(data){
				var a=$("#dels").attr("name");
				if(a!=0){
					$("#a"+a).find("a").css("color","#333333");
				}
				$("#dels").attr("name",data);
				$("#dels").css("background-color","#00F7DE");
				$("#a"+data).find("a").css("color","#666666");
			}
			
			function del(){
				var data = $("#dels").attr("name");
				if(data!=0){
					$.ajax({ //
						type : "get",
						url : "${basePath}delhotspecial", //添加操作的路径
						data :{listtype:data},
						dataType : "JSON", //返回JSON格式的数据
						async : false,//同步传输
						success : function(data) {
							if(data==0){
								alert("删除失败！！");
							}else if(data==2){
								alert("请先登录！！");
							}
							location.reload();
						}
					});
				}
			}
		</script>
	</div>	
	</body>
</html>